﻿namespace MicroMVVM
{
    /// <summary>
    /// This interface represents the interface for DataModels which are required to return design time data.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IDesigntimeData<out T>
    {
        /// <summary>
        /// Gets the design time data model.
        /// </summary>
        /// <returns></returns>
        T GetDataModel();
    }

    /// <summary>
    /// This class represents the DesignDataModel for design time data. 
    /// </summary>
    /// <typeparam name="T">The targeted DataModel</typeparam>
    /// <typeparam name="U">The expected object populated with design time data</typeparam>
    public class DesignDataModel<T, U>
        where T : IDesigntimeData<U>, new()
        where U : class
    {
        /// <summary>
        /// Gets the design time data object.
        /// </summary>
        /// <returns>Design time data object.</returns>
        public static U Get()
        {
            var dataModel = new T();

            return dataModel.GetDataModel();
        }
    }
}